<template>
  <a-row :gutter="24">
    <a-col :md="24">
      <a-card :style="cardStyle" :bordered="false">
        <!-- 查询区域 -->
        <div class="table-page-search-wrapper">
          <!-- 搜索区域 -->
          <a-form layout="inline" @keyup.enter.native="searchQuery">
            <a-row :gutter="24">
              <a-col :md="6" :sm="24">
                <a-form-item :label="$t('systemManagement.corporateName')" :labelCol="labelCol" :wrapperCol="wrapperCol">
                  <a-input :placeholder="$t('systemManagement.corporateName')"
                    v-model="conditionName"></a-input>
                </a-form-item>
              </a-col>
              <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
                <a-col :md="6" :sm="24">
                  <a-button type="primary" @click="searchQuery">{{ $t('basicInformation.query') }}</a-button>
                  <a-button style="margin-left: 8px" @click="searchReset">{{ $t('basicInformation.reset') }}</a-button>
                </a-col>
              </span>
            </a-row>
          </a-form>
        </div>
        <!-- 操作按钮区域 -->
        <div class="table-operator" style="margin-top: 5px">
          <a-button v-if="btnEnableList.indexOf(1) > -1" @click="handleAdd" type="primary" icon="plus">{{
              $t('basicInformation.newlyAdded')
          }}</a-button>
          <!-- <a-button icon="delete" @click="batchDel">{{ $t('basicInformation.delete') }}</a-button> -->
          <!-- <a-button type="primary" @click="handleEdit">{{ $t('systemManagement.newlAdded') }}</a-button>
          <a-button type="dashed" @click="handleEdit">{{ $t('setailManagement.edit') }}</a-button> -->
          <a-dropdown>
            <a-menu slot="overlay">
              <a-menu-item key="1" v-if="btnEnableList.indexOf(1) > -1" @click="batchDel"><a-icon type="delete" />{{
                  $t('basicInformation.delete')
              }}</a-menu-item>
            </a-menu>
            <a-button>
              {{ $t('basicInformation.batchOperation') }} <a-icon type="down" />
              <!-- <a-select>
                <a-select-item>
                  <a-button danger :size="size">{{ $t('defaultTranslate.delete') }}</a-button>
                </a-select-item>
              </a-select> -->
              <a-menu slot="overlay">
                <a-menu-item><a-icon type="delete" />{{
                    $t('manuManagement.delete')
                }}</a-menu-item>
              </a-menu>
            </a-button>
          </a-dropdown>
        </div>
        <!-- table区域-begin -->
        <div>
          <a-table ref="table" size="middle" bordered rowKey="id" :columns="columns" :customRow="rowClick"
            :dataSource="dataSource" :pagination="ipagination" :scroll="scroll" :loading="loading"
            :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }" @change="handleTableChange">
          </a-table>
        </div>
        <!-- 表单区域 -->
        <transport-modal ref="modalForm" @ok="modalFormOk"></transport-modal>
      </a-card>
    </a-col>
  </a-row>
</template>
<script>
import TransportModal from './modules/TransportModal'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import JDate from '@/components/jeecg/JDate'
export default {
  name: "TransportList",
  mixins: [JeecgListMixin],
  components: {
    TransportModal,
    JDate
  },
  data() {
    return {
      labelCol: {
        span: 5
      },
      wrapperCol: {
        span: 18,
        offset: 1
      },
      // 查询信息
      conditionName: '',
      // 表头
      columns: [
        {
          title: this.$t('systemManagement.corporateName'),
          align: "center",
          dataIndex: 'transpotName',
          width: 80
        },
        {
          title: this.$t('systemManagement.corporateCode'),
          align: "center",
          dataIndex: 'transpotNo',
          width: 80
        },
        {
          title: this.$t('basicInformation.operation'),
          dataIndex: 'action',
          align: "center",
          width: 150,
          scopedSlots: { customRender: 'action' },
        }
      ],
      url: {
        list: "/transport/list",
        delete: "/transport/delete",
        deleteBatch: "/transport/deleteBatch"
      }
    }
  },
  computed: {

  },
  methods: {
    rowClick(record, index) {
      return {
        on: {
          click: () => {
          },
          dblclick: () => {
            this.handleEdit(record)
          },
        }
      }
    },
    handleEdit: function (record) {
      this.$refs.modalForm.edit(record);
      this.$refs.modalForm.title = this.$t('basicInformation.edit');
      this.$refs.modalForm.disableSubmit = false;
      if (this.btnEnableList.indexOf(1) === -1) {
        this.$refs.modalForm.isReadOnly = true
      }
    }
  }
}
</script>
<style scoped>
@import '~@assets/less/common.less'
</style>